package com.example.analysis.controller;

import com.example.analysis.domain.ScoreInfo;
import com.example.analysis.entity.PageBean;
import com.example.analysis.service.*;
import com.example.analysis.utils.Response1;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/showData")
public class ShowDataController {
    @Resource
    StudentService studentService;
    @Resource
    ElectionService electionService;
    @Resource
    CompetitionListService competitionListService;
    @Resource
    EvaluateListStudentService evaluateListStudentService;
    @Resource
    EvaluateSupervisionService evaluateSupervisionService;
    /**
     * 学生基础数据
     * @param pageNum  页码
     * @param pageSize 每页多少行
     * @return
     */
    @GetMapping("/studentData")
    public Response1<PageBean> getAll(Integer pageNum,Integer pageSize) {
        PageBean pageBean = studentService.getAll(pageNum, pageSize);
        Response1<PageBean> listResponse1 = new Response1<>(20000, "成功", pageBean);
        return listResponse1;
    }

    @GetMapping("/scoreData")
    public Response1<PageBean> getScore(Integer pageNum,Integer pageSize){
        PageBean pageBean=electionService.getAll(pageNum, pageSize);
        Response1<PageBean> listResponse1 = new Response1<>(20000, "成功", pageBean);
        return listResponse1;
    }

    @GetMapping("/competitionData")
    public Response1<PageBean> getCompetition(Integer pageNum,Integer pageSize){
        PageBean pageBean=competitionListService.getAll(pageNum, pageSize);
        Response1<PageBean> listResponse1 = new Response1<>(20000, "成功", pageBean);
        return listResponse1;
    }

    @GetMapping("/evaluateStudent")
    public Response1<PageBean> getEvaluate(Integer pageNum,Integer pageSize){
        PageBean pageBean=evaluateListStudentService.getEvaluate(pageNum, pageSize);
        Response1<PageBean> listResponse1 = new Response1<>(20000, "成功", pageBean);
        return listResponse1;
    }

    @GetMapping("/evaluateStudentData")
    public Response1<PageBean> getEvaluateStudent(Integer pageNum,Integer pageSize,String semester){
        PageBean pageBean=evaluateListStudentService.getAll(pageNum, pageSize,semester);
        Response1<PageBean> listResponse1 = new Response1<>(20000, "成功", pageBean);
        return listResponse1;
    }

    @GetMapping("/evaluateSupervision")
    public Response1<PageBean> getEvaluateSupervision(Integer pageNum,Integer pageSize){
        PageBean pageBean=evaluateSupervisionService.getSupervision(pageNum, pageSize);
        Response1<PageBean> listResponse1 = new Response1<>(20000, "成功", pageBean);
        return listResponse1;
    }

    @GetMapping("/course")
    public Response1<PageBean> getCourse(Integer pageNum,Integer pageSize){
        PageBean pageBean=evaluateSupervisionService.getAllCourse(pageNum, pageSize);
        Response1<PageBean> listResponse1 = new Response1<>(20000, "成功", pageBean);
        return listResponse1;
    }
}
